<h4><?php echo lang('Query Details')?></h4>
<form action="query.php" method="get">
	<input type="hidden" name="<?php echo session_name()?>" value="<?php echo session_id()?>" />
	<table border="0">
	<tr>
		<td><textarea name="sql" rows="7" cols="80"><?php echo htmlspecialchars($origSql)?></textarea></td>
	</tr>
	<tr>
		<td align="right"><input type="submit" value="<?php echo lang('Execute Query')?>" /></td>
	</tr>
	</table>
</form>
<?if($querySuccessful):?>
	<?if($queryHasResults):?>
	<table border="0">
		<?foreach($resultsTable as $row):?>
	<tr>
		<?if(!$headersWritten):?>
		<?$headersWritten = true?>
		<?if($showEditDelete):?>
		<td>&nbsp;</td>
		<?endif?>
		<?foreach($headers as $h):?>
		<th><?php echo $h?></th>
		<?endforeach?>
	</tr>
	<tr>
		<?endif?>
		<?foreach($row as $c):?>
		<td><?php echo $c?></td>
		<?endforeach?>
	</tr>
		<?endforeach?>
	</table>
		<?if($showEditDelete):?>
			<p><a href="row.php?action=insert&table=<?php echo $tablename?>&<?php echo SID?>&redirect=<?php echo rawurlencode(common::url())?>">Insert new row</a></p>
		<?endif?>
	<?endif?>
<?elseif($querySuccessful === false):?>
	Error! (<?php echo $DB->getLastError()?>)
<?endif?>